//
// Copyright 2001-2004 Stottler Henke Associates, Inc.
// All Rights Reserved.
//////////////////////////////////////////////////////////////////////

package com.stottlerhenke.simbionic.engine.file;

import java.io.InputStream;
import java.net.*;
import com.stottlerhenke.simbionic.common.SB_FileException;

/**
 * This class encapsulates the ability to read specification data from
 * URL or open stream.
 */
abstract public class SB_FileReader
{
	protected URL _fileURL;
	protected InputStream _stream;
	
	/**
	 * Constructor
	 * @param fileURL URL for the specification file
	 */
	public SB_FileReader(URL fileURL)
	{
		_fileURL = fileURL;
		_stream = null;
	}
	
	/**
	 * Constructor
	 * @param stream an open stream for reading
	 */
	public SB_FileReader(InputStream fileStream)
	{
		_stream = fileStream;
	}
	
	/**
	 * Prepares the file stream for reading.
	 */
	abstract public void prepare() throws SB_FileException;

	/**
	 * Closes the file stream.
	 */
	abstract public void close();
}
